#ifndef _WX_ANIMATE_H_
#define _WX_ANIMATE_H_

#include "wx/defs.h"

#if wxUSE_ANIMATIONCTRL

#include "wx/animdecod.h"
#include "wx/control.h"
#include "wx/timer.h"
#include "wx/bitmap.h"

class  wxAnimation;

extern wxAnimation wxNullAnimation;
extern const wxChar wxAnimationCtrlNameStr[];

class wxAnimationBase : public wxGDIObject {
  public:
    wxAnimationBase() {}

    virtual bool IsOk() const = 0;

    // can be -1
    virtual int GetDelay( unsigned int frame ) const = 0;

    virtual unsigned int GetFrameCount() const = 0;
    virtual wxImage GetFrame( unsigned int frame ) const = 0;
    virtual wxSize GetSize() const = 0;

    virtual bool LoadFile( const wxString& name,
                           wxAnimationType type = wxANIMATION_TYPE_ANY ) = 0;
    virtual bool Load( wxInputStream& stream,
                       wxAnimationType type = wxANIMATION_TYPE_ANY ) = 0;

  protected:
    DECLARE_ABSTRACT_CLASS( wxAnimationBase )
};

#define wxAC_NO_AUTORESIZE       (0x0010)
#define wxAC_DEFAULT_STYLE       (wxNO_BORDER)

class wxAnimationCtrlBase : public wxControl {
  public:
    wxAnimationCtrlBase() { }

    // public API
    virtual bool LoadFile( const wxString& filename,
                           wxAnimationType type = wxANIMATION_TYPE_ANY ) = 0;

    virtual void SetAnimation( const wxAnimation &anim ) = 0;
    virtual wxAnimation GetAnimation() const = 0;

    virtual bool Play() = 0;
    virtual void Stop() = 0;

    virtual bool IsPlaying() const = 0;

    virtual void SetInactiveBitmap( const wxBitmap &bmp );

    // always return the original bitmap set in this control
    wxBitmap GetInactiveBitmap() const
    { return m_bmpStatic; }

  protected:
    // the inactive bitmap as it was set by the user
    wxBitmap m_bmpStatic;

    // the inactive bitmap currently shown in the control
    // (may differ in the size from m_bmpStatic)
    wxBitmap m_bmpStaticReal;

    // updates m_bmpStaticReal from m_bmpStatic if needed
    virtual void UpdateStaticImage();

    // called by SetInactiveBitmap
    virtual void DisplayStaticImage() = 0;

  private:
    DECLARE_ABSTRACT_CLASS( wxAnimationCtrlBase )
};


// ----------------------------------------------------------------------------
// include the platform-specific version of the wxAnimationCtrl class
// ----------------------------------------------------------------------------

#if defined(__WXGTK20__) && !defined(__WXUNIVERSAL__)
#include "wx/gtk/animate.h"
#else
#include "wx/generic/animate.h"
#endif

#endif // wxUSE_ANIMATIONCTRL

#endif // _WX_ANIMATE_H_
